/* -*-c++-*- OpenRTI - Copyright (C) 2004-2023 Mathias Froehlich
 *
 * This file is part of OpenRTI.
 *
 * OpenRTI is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * OpenRTI is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with OpenRTI.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include "Thread.h"
#include "ThreadPrivateDataPosix.h"
#include "Exception.h"

namespace OpenRTI {

Thread::Thread(void) :
  _privateData(new PrivateData)
{
}

Thread::~Thread(void)
{
  OpenRTIAssert(!Thread::count(this));
  delete _privateData;
  _privateData = 0;
}

void Thread::destruct(Thread* thread)
{
  delete thread;
}

bool
Thread::start()
{
  return _privateData->start(*this);
}

void
Thread::wait()
{
  _privateData->wait();
}

} // namespace OpenRTI
